import java.util.Random;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = in.nextInt();
        while(num != 0) {
            System.out.print((num % 10) + " ");
            num /= 10;
        }
    }

    //获取一个数二进制序列中所有的偶数位和奇数位， 分别输出二进制序列
    public static void main12(String[] args) {
        System.out.println("请输入一个数字：");
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        int tmp = 0;
        //从右往左数
        System.out.println("奇数位是：");
        for (int i = 31; i >= 0; i -= 2) {
            tmp = (num >> i) & 1;
            System.out.print(tmp + " ");
        }
        System.out.println();
        System.out.println("偶数位是：");
        for (int i = 30; i >= 0; i -= 2) {
            tmp = (num >> i) & 1;
            System.out.print(tmp + " ");
        }
    }

    //模拟登陆
    public static void main11(String[] args) {
        int count = 3;
        Scanner scanner = new Scanner(System.in);
        while(count != 0) {
            System.out.println("请输入密码：");
            String password = scanner.nextLine();
            if(password.equals("abcdef")) {
                System.out.println("登录成功！");
                break;
            } else {
                count--;
                System.out.println("你还有" + count + "次机会！");
            }
        }
        if(count == 0) {
            System.out.println("登录失败！");
        }
    }

    public static void main10(String[] args) {
        int n = 5;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (i == j || i + j == n - 1) {
                    System.out.print("*");
                } else {
                    System.out.print(" ");
                }
            }
            System.out.println();
        }
    }

    public static void main9(String[] args) {
        Scanner scanner = new Scanner(System.in);
        //生成随机数
        Random random = new Random();
        int randNum = random.nextInt(100);//生成[0,100)之间的随机数
        while (true) {
            System.out.println("请输入要猜的数字：");
            int num = scanner.nextInt();
            if (num > randNum) {
                System.out.println("猜大了");
            } else if (num == randNum) {
                System.out.println("猜对了");
                return;
            } else {
                System.out.println("猜小了");
            }
        }
    }

    public static void main8(String[] args) {
        for (int i = 0; i < 9999999; i++) {
            int count = 0;
            int tmp = i;
            //有多少位数
            while(tmp != 0){
                count++;
                tmp /= 10;
            }
            int sum = 0;
            tmp = i;
            while(tmp != 0) {
                sum += Math.pow(tmp % 10, count);
                tmp /= 10;
            }
            if(sum == i) {
                System.out.println(i);
            }
        }

    }


    //123每个数字之和
    public static int funcNumAdd(int n) {
        if(n < 10) {
            return n;
        }
        //3 + funcNumAdd(12)
        return n % 10 + funcNumAdd(n / 10);
    }

    public static void main6(String[] args) {
        System.out.println(funcNumAdd(1724));
    }


    //1+2+3+...+10
    public static int func(int a) {
        if(a == 1) {
            return 1;
        }
        return a + func(a - 1);
    }

    public static void main5(String[] args) {
        System.out.println(func(3));
    }


    //方法的重载
    public static int maxNum(int x, int y) {
        return x > y ? x : y;
    }

    public static int maxNum(int x, int y, int z) {
        int tmp = maxNum(x,y);
        return maxNum(tmp,z);
    }



    //水仙花数
    public static void main4(String[] args) {
        int n = 0;
        int sum = 0;
        //产生所有的三位数
        for (int i = 100; i <= 999; i++) {
            n = i % 10;
            n = i / 10 ;
            if(i / 10 != 0) {

            }
        }
    }

    //给定一个数字，判定一个数字是否是素数
    public static void main7(String[] args) {
        int n = 9;
        int i = 2;
        for (; i <= Math.sqrt(n); i++) {
            if(n % i == 0) {
                System.out.println(n + "不是素数");
                break;
            }
        }
        if(i > Math.sqrt(n)) {
            System.out.println(n + "是素数");
        }
    }

    public static void main3(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        boolean isPrime = true;
        //1 不是素数
        if(num == 1) {
            isPrime = false;
        }
        for (int i = 2; i <= num - 1; i++) {
            if(num % i == 0) {
                isPrime = false;
                break;
            }
        }
        if( isPrime) {
            System.out.println(num +"是素数");

        }
        else {
            System.out.println(num + "不是素数");
        }
    }


    //编写程序数一下 1到 100 的所有整数中出现多少个数字9
    public static void main2(String[] args) {
        //产生1-100的数字
        int num = 0;
        for (int i = 1; i <= 100; i++) {
            if(i % 10 == 9) {
                num++;
            }
            if(i / 10 == 9) {
                num++;
            }
        }
        System.out.println(num);//20
    }


    //既能被3整除又能被6整除的数字  要求使用break或者continue
    public static void main1(String[] args) {
        int i = 1;
        while(i <= 100) {
            if((i % 3 != 0) || (i % 6 != 0)) {
                i++;
                continue;
            }
            System.out.println(i);
            i++;
        }
    }
}